/*
 * Copyright (C) 2008 Rob Cash
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * 	http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

package org.robcash.commons.swing.wizard.event;

import java.util.EventObject;
import org.robcash.commons.swing.wizard.Wizard;
import org.robcash.commons.swing.wizard.WizardPanel;

/**
 *
 * @author Rob
 */
public class WizardPanelEvent extends EventObject {

    /**
     * Old panel
     */
    private WizardPanel oldPanel;

    /**
     * New panel
     */
    private WizardPanel newPanel;

    /**
     * Create a new wizard panel event with the specified wizard as the source
     * @param source Wizard that triggered the event
     */
    public WizardPanelEvent(Wizard source) {
        super(source);
    }

    /**
     * Create a new wizard panel event with the specified wizard as the source
     * @param source Wizard that triggered the event
     * @param oldPanel Old or outgoing wizard panel
     * @param newPanel New or incoming wizard panel
     */
    public WizardPanelEvent(Wizard source, WizardPanel oldPanel, WizardPanel newPanel) {
        this(source);
        setOldWizardPanel(oldPanel);
        setNewWizardPanel(newPanel);
    }

    /**
     * Get the wizard that triggered the event
     * @return Wizard that triggered the event
     */
    public Wizard getWizard() {
        return (Wizard) source;
    }

    /**
     * Get the old wizard panel
     * @return Old wizard panel
     */
    public WizardPanel getOldWizardPanel() {
        return oldPanel;
    }

    /**
     * Set the old wizard panel
     * @param panel Old wizard panel
     */
    public void setOldWizardPanel(WizardPanel panel) {
        this.oldPanel = panel;
    }

    /**
     * Get the new wizard panel
     * @return New wizard panel
     */
    public WizardPanel getNewWizardPanel() {
        return newPanel;
    }

    /**
     * Set the new wizard panel
     * @param panel New wizard panel
     */
    public void setNewWizardPanel(WizardPanel panel) {
        this.newPanel = panel;
    }

}
